package com.fy.market.strategy.service.rule.chain;

/**
 * @author fwq
 * @date 2025-09-18
 * @desc 责任链装配接口
 */
public interface ILogicChainArmory {

    // 获取下一个责任链节点
    ILogicChain next();

    // 拼接下一个责任链节点
    ILogicChain appendNext(ILogicChain next);
    
    // 获取当前节点名称
    default String getNodeName() {
        return this.getClass().getSimpleName();
    }
    
    // 获取责任链完整信息
    default String getChainInfo() {
        StringBuilder chainInfo = new StringBuilder();
        ILogicChain current = (ILogicChain) this;
        int index = 1;
        
        while (current != null) {
            chainInfo.append("节点").append(index).append(": ").append(current.getNodeName());
            current = current.next();
            if (current != null) {
                chainInfo.append(" -> ");
            }
            index++;
        }
        
        return chainInfo.toString();
    }
}
